﻿using System;
using System.Collections.Generic;
using System.Text;
using Belmost4PDA.Fasade;

namespace Belmost4PDA.Logic
{
    public abstract class AbstractValueController
    {
        public enum ControllerType
        {
            NoControl = 0, Integer = 1, IntegerWithRange = 2, Double = 3, DefDouble = 4
        }
        public abstract bool Check(string Value);
        public abstract string DefaultValue();
        public static AbstractValueController GetController(ControllerType type, PanelItem panelItem)
        {
            switch(type)
            {
                case ControllerType.NoControl:
                    return new ControllerNoControl();
                case ControllerType.Integer:
                    return new ControllerInteger();
                case ControllerType.IntegerWithRange:
                    return new ControllerIntegerRange(panelItem.minVal, panelItem.maxVal);
                case ControllerType.Double:
                    return new ControllerDouble(panelItem.numallLenght,panelItem.numfraction);
                case ControllerType.DefDouble:
                    return new ControllerDouble(10,6); //defscope field check
            }
            throw new ArgumentException("неправильный тип контроллера");
        }
        public virtual string Normalize(string NotNormalValue)
        {
            return NotNormalValue;
        }
    }
}
